#include "dialog.h"
#include<QLabel>
#include<QPushButton>
#include<QVBoxLayout>
Dialog::Dialog(QWidget* parent) : QDialog(parent)
{
    QPushButton* b1 = new QPushButton("关闭",this);
    QLabel* l1 = new QLabel(this);
    l1->setText("这是一个对话框");
    QVBoxLayout* lay = new QVBoxLayout(this);
    lay->addWidget(l1);
    lay->addWidget(b1);
    connect(b1,&QPushButton::clicked,this,[this]()
    {
       this->close();
    });
}
